package play.`class`

enum class Color {
    RED, BLACK, BLUE, GREEN, WHITE
}

enum class Color2(val rgb: Int) {
    RED(0xFF0000),
    GREEN(0x00FF00),
    BLUE(0x0000FF)
}

enum class Shape(var value: Int) {
    OVEL(100),
    RECTANGLE(200)
}

enum class ProtocolState {
    WAITING {
        override fun signal() = TALKING
    },

    TALKING {
        override fun signal() = WAITING
    };

    abstract fun signal(): ProtocolState
}

fun main() {
    println(Color.BLUE)
    println(Color.BLUE.name)
    println(Color.BLUE.ordinal)
    println(Color.valueOf("RED"))
    println(Color2.BLUE)
    println(Color2.BLUE.name)
    println(Color2.BLUE.rgb)
    println(Color2.valueOf("RED").rgb)
    println(Shape.OVEL.ordinal)
    println(Shape.OVEL.value)
    println(Shape.RECTANGLE)
    println(ProtocolState.TALKING.signal().name)
}